package com.kurancy.web.authentication;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Component;

import com.kurancy.domain.KurancyUser;

@Component
public class SessionManagerImpl implements SessionManager {
	
	private static final String KURANCY_USER = "kurancyUser";

	@Override
	public KurancyUser getKurancyUser(HttpServletRequest req) {
		return (KurancyUser) req.getSession().getAttribute(KURANCY_USER);
	}
	
	@Override
	public void setKurancyUser(HttpServletRequest req, KurancyUser kurancyUser) {
		req.getSession().setAttribute(KURANCY_USER, kurancyUser);
	}
	
	@Override
	public void removeKurancyUser(HttpServletRequest req) {
		req.getSession().removeAttribute(KURANCY_USER);
	}

}
